package com.skb.core.service;

import com.skb.core.dao.AccountDao;
import com.skb.core.model.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

@Service("accountService")
public class AccountService implements IAccountService {

    @Autowired
    private AccountDao accountDao;

    @Override
    public Account create(Account account) {
        return accountDao.create(account);
    }

    @Override
    public Account get(Serializable id) {
        return accountDao.get(id);
    }

    @Override
    public Account update(Account account) {
        return accountDao.update(account);
    }

    @Override
    public void delete(Account account) {
        accountDao.delete(account);
    }

    @Transactional(readOnly = true)
    @Override
    public List<Account> findAll() {
        return accountDao.findAll();
    }

    @Transactional(readOnly = true)
    @Override
    public List<Account> findByUsername(Serializable username) {
        return accountDao.findByUsername(username);
    }
}
